package com.huaxin.hxmoduleworkorder.dto;


/**
 * 响应码
 *
 * @author
 * @date 2025/04/01
 */
public enum ResponseCode {
    // ========== 成功 ==========
    SUCCESS(200, "成功"),

    // ========== 客户端错误（4xx） ==========
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源未找到"),
    METHOD_NOT_ALLOWED(405, "请求方法不支持"),
    CONFLICT(409, "资源冲突"),
    UNAUTHORIZED_ERROR(401, "未授权"),
    UNPROCESSABLE_ENTITY(422, "数据校验失败"),
    VERIFICATION_CODE_ERROR(423, "验证码错误"),

    // ========== 服务端错误（5xx） ==========
    INTERNAL_SERVER_ERROR(500, "系统内部错误，请联系管理员"),
    SERVICE_UNAVAILABLE(503, "服务暂时不可用，请稍后重试"),
    GATEWAY_TIMEOUT(504, "网关超时"),

    // ========== 业务相关错误 ==========
    ORDER_NOT_FOUND(1001, "工单不存在"),
    ORDER_ALREADY_COMPLETED(1002, "工单已完成，无法修改"),
    ORDER_ALREADY_CANCELLED(1003, "工单已取消，无法操作"),
    ILLEGAL_ORDER_STATUS(1004, "当前工单状态不允许执行该操作"),
    PERMISSION_DENIED(1005, "当前用户角色无权限执行此操作"),
    OPERATOR_ROLE_INVALID(1006, "操作人角色无效"),
    MAINTENANCE_ORDER_LOCKED(1007, "工单已被锁定，无法操作"),
    FEEDBACK_ALREADY_SUBMITTED(1008, "评价已提交，无法重复提交"),
    FILE_UPLOAD_FAILED(1009, "文件上传失败"),
    DATA_CONFLICT(1010, "数据版本冲突，请刷新后重试"),

    // ========== 流程相关 ==========
    PROCESS_DEFINITION_NOT_FOUND(2001, "流程定义不存在"),
    PROCESS_INSTANCE_NOT_FOUND(2002, "流程实例不存在"),
    TASK_ALREADY_COMPLETED(2003, "任务已处理，请勿重复提交"),
    CANNOT_ROLLBACK_TO_CURRENT_STATE(2004, "无法回退至当前状态"),

    // ========== 自定义业务异常（可选） ==========
    CUSTOM_BUSINESS_ERROR(3000, "业务逻辑异常");

    private final int code;
    private final String message;

    ResponseCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}